<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Window resize example</title>
    <style>
      body {
        margin: 0;
      }

      div {
        box-sizing: border-box;
        width: 100px;
        height: 100px;
        background-image: url(bgtile.png);
        border: 10px solid white;
      }
    </style>
  </head>
  <body>

    <div>

    </div>

    <script>
      var div = document.querySelector('div');

      function resize() {
        var WIDTH = window.innerWidth;
        var HEIGHT = window.innerHeight;

        div.style.width = WIDTH + 'px';
        div.style.height = HEIGHT + 'px';
      }

      window.onresize = resize;
      resize();
    </script>
  </body>
</html>
